<?php
include_once "../ini.php";
include_once "../includes/myfunction.php";
include "../thu_vien/xl_friend.php";
include "../thu_vien/xl_user.php";
include "../thu_vien/xl_school.php";
include "../thu_vien/xl_education.php";


/*
if(!isset($_GET['id']) || !isset($_GET['sk'])) {
	header('Location: '.$_SERVER['HTTP_REFERER']);
	exit;
}
*/


$dt_xl_friend = new xl_friend;
$dt_xl_user = new xl_user;
$dt_xl_school = new xl_school;
$dt_xl_education = new xl_education;

//$uid= '100000192549826';
$uid = '';
if(!isset($_GET['id'])){
	$uid = $_SESSION['UID'];
}
else {
	$uid = $_GET['id'];
	$kq = $dt_xl_user->kiem_tra($uid);
	if(!$kq['uid']) {
		$_SESSION['msg'] = 'Lỗi ! Nội dung không khả dụng!';
		$_SESSION['type_msg'] = 'error';
		header("Location: ".$_SERVER['HTTP_REFERER']);
		exit;
	}
}
/*$kq = $dt_xl_user->kiem_tra($uid);
if(!$kq){
	$_SESSION['msg'] = 'Lỗi! Không truy cập được danh sách bạn bè';
	$_SESSION['type_msg'] = 'error';
	header('Location: '.$_SERVER['HTTP_REFERER']);
	exit;
}*/

$slbb = $dt_xl_friend->so_luong_ban_be($uid);

$dsbb = $dt_xl_friend->danh_sach_ban_be($uid);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="../css/style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="../css/style.ie7.css" type="text/css" media="screen" /><![endif]-->
<link rel="stylesheet" href="../css/mystyle.css" type="text/css" media="screen" />
<title>Friend</title>
<script type="text/javascript" src="../css/jquery.js"></script>
<script type="text/javascript" src="../css/script.js"></script>
</head>
<body>
<div id="art-page-background-glare">
  <div id="art-page-background-glare-image">
    <div id="art-main">
      <div class="art-sheet">
        <div class="art-sheet-tl"></div>
        <div class="art-sheet-tr"></div>
        <div class="art-sheet-bl"></div>
        <div class="art-sheet-br"></div>
        <div class="art-sheet-tc"></div>
        <div class="art-sheet-bc"></div>
        <div class="art-sheet-cl"></div>
        <div class="art-sheet-cr"></div>
        <div class="art-sheet-cc"></div>
        <div class="art-sheet-body"> 
          <!--BEGIN: HEADER-->
          <?php include "../widgets/header.php"; ?>
          <!--END: HEADER--> 
          <!--BEGIN: NAVIGATION MENU-->
          <?php include "../widgets/nav.php"; ?>
          <!--END: NAVIGATION MENU-->
          
          <div class="art-content-layout">
            <div class="art-content-layout-row">
              <div class="art-layout-cell art-sidebar1">
                <div class="art-vmenublock">
                  <div class="art-vmenublock-tl"></div>
                  <div class="art-vmenublock-tr"></div>
                  <div class="art-vmenublock-bl"></div>
                  <div class="art-vmenublock-br"></div>
                  <div class="art-vmenublock-tc"></div>
                  <div class="art-vmenublock-bc"></div>
                  <div class="art-vmenublock-cl"></div>
                  <div class="art-vmenublock-cr"></div>
                  <div class="art-vmenublock-cc"></div>
                  <div class="art-vmenublock-body"> <img src="../upload/avatar.jpg" width="170"/>
                    <div class="cleared"></div>
                  </div>
                </div>
                <!--BEGIN: VERTICAL MENU-->
                <?php
					   $pos = 'left'; 
					   sidebar($pos);
					   ?>
                <!--END: VERTICAL MENU-->
                
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-content">
               
                
                  <div class="art-post">
                  <div class="art-post-body">
                    <div class="art-post-inner art-article">
                      <h2 class="art-postheader"><a class="hovered" href="#"><?php echo $user['name']?></a><img class="mui_ten" src="../images/right.png" />Bạn Bè (<?php echo $slbb; ?>)</h2>
                      <div class="line"></div>
                      <div class="art-postcontent">
                      <br/>
                      <?php message();?>
                      
                        <?php 
					foreach ($dsbb as $bb){
						$fr =  $bb['uid2'];
					
						$user = $dt_xl_user->xem($fr);
						$scid = $dt_xl_education->xem_current($fr);
						if (!empty($user)){
						if($scid != ''){
							$truong = $dt_xl_school->lay_truong($scid['scid']);
							
						}
						
					?>
                  <div class="friend">
                    <div class="f_img"><a href="../profile/index.php?id=<?php echo $user['uid']; ?>"><img width="100" height="100" src="<?php echo $user['pic']; ?>" /></a></div>
                    <div class="f_ten"><a href="../profile/index.php?id=<?php echo $user['uid']; ?>"><?php echo $user['name']; ?> </a></div>
                    <div class="f_truong"><?php echo $truong; $truong='';?></div>
                  </div>
                  <?php
}
					}
?>
                      </div>
                      <div class="cleared"></div>
                    </div>
                    <div class="cleared"></div>
                  </div>
                </div>
                
                
                <div class="cleared"></div>
              </div>
              <div class="art-layout-cell art-sidebar2">
                <?php 
						  $pos = 'right';
						  sidebar($pos);
						  ?>
                <div class="cleared"></div>
              </div>
            </div>
          </div>
          <div class="cleared"></div>
          <div class="cleared"></div>
        </div>
      </div>
      <div class="art-footer">
        <div class="art-footer-t"></div>
        <div class="art-footer-body"> <a href="#" class="art-rss-tag-icon" title="RSS"></a>
          <div class="art-footer-text">
            <p><a href="#">Link1</a> | <a href="#">Link2</a> | <a href="#">Link3</a></p>
            <p>Copyright © 2012. All Rights Reserved.</p>
            <div class="cleared"></div>
            <p class="art-page-footer"><a href="http://www.artisteer.com/?p=joomla_templates">Joomla template</a> created with Artisteer.</p>
          </div>
          <div class="cleared"></div>
        </div>
      </div>
    </div>
  </div>
</div>
</body>
</html>